
#include<iostream>

//模板方法模式
class Drink
{
public:
    //烧水
    virtual void Boil() = 0;
    //放入原料
    virtual void Brew() = 0;
    //搅拌
    virtual void Pour() = 0;

    void MakeDrink()
    {
        Boil();
        Brew();
        Pour();
    }

};

//必须实现所有纯虚函数，才能实例化对象
class MilkTea:public Drink
{
public:
    void Boil()
{
    std::cout<<"hot milk"<<std::endl;
}

    void Brew() { std::cout<<"brew milk tea"<<std::endl; }
    void Pour() { std::cout<<"pour milk tea"<<std::endl; }
};


int main ()
{
    Drink *d = new MilkTea;
    d->MakeDrink();
    return 0;
}